Skip to content

Result gen#38

Open
mzecc wants to merge 39 commits intomainfrom
result-gen
Open

Result gen#38
mzecc wants to merge 39 commits intomainfrom
result-gen

Conversation

@mzecc
Copy link
Collaborator

@mzecc mzecc commented Nov 25, 2025

Description

Alternative path to achieve the same thing. All the result type are contained in a unique ResultGen object so that we now have a unique instance_array of the ResultGen type.

I am now working on the testing part.

Checklist

Please confirm that this pull request has done the following:

  • Tests added
  • Documentation added (where applicable)
  • Changelog item added to changelog/

@mzecc mzecc requested a review from znicholls November 25, 2025 13:38
@codecov
Copy link

codecov bot commented Dec 23, 2025

Codecov Report

❌ Patch coverage is 91.58879% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.85%. Comparing base (ca2a5f5) to head (4e8c88f).

Files with missing lines Patch % Lines
src/example_fgen_basic/result/result_gen.py 91.35% 4 Missing and 3 partials ⚠️
src/example_fgen_basic/get_square_root.py 91.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##              main      #38      +/-   ##
===========================================
- Coverage   100.00%   94.85%   -5.15%     
===========================================
  Files            7       10       +3     
  Lines           68      175     +107     
  Branches         0       20      +20     
===========================================
+ Hits            68      166      +98     
- Misses           0        5       +5     
- Partials         0        4       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@znichollscr znichollscr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. I like the fact that we only have to deal with one object type, therefore wrapping is a bit simpler. The tradeoff is that we have to deal with checking "What type of object do I have" elsewhere. I'm not sure if that makes things better or worse on balance. Suggestion for now, let's try with this and continue onto the next steps (actually trying to put a basic climate model in here). Once we've done that, we can make a decision about what we like and don't like.

@znichollscr
Copy link

Thinking about it more, the other thing I don't love is that we're going to have to alter ResultGen every time we want to support returning a new type. I think that will be more annoying than building tools that help us write the appropriate wrappers in an automated way, but see what you think and let's see.

@mzecc
Copy link
Collaborator Author

mzecc commented Feb 11, 2026

Yes, I agree with both points you made. I was also concerned about ResultGen turning into a huge container with hundreds of objects whose types we constantly need to check. Ultimately, it depends on how many object types we’ll have to handle in the end. Still you made a very good point, the design is not very flexible, since we would need to modify basically every layer whenever we want to support a new type. Right now, the more I think about the whole ResultGen idea, the less convinced I become.

What I initially liked about it was that having a single, centralized array unified memory management. It also led me to create the tag attribute, which helped flag whether a slot is free or not. And freeing the error_v array allowed me to use it for bubbling up errors instead.

But perhaps these are more "didactic" conveniences than actual code advantages.. we could achieve the same behavior in other ways I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants